#pragma once
#include "fxcc/core/graph/common/ImageMipmap.h"
#include "fxcc/core/graph/common/AttachmentType.h"
#include "fxcc/core/graph/common/Texture2DJack.h"

namespace fxcc
{
	namespace graph
	{
		namespace common
		{
			struct FXCC_API RenderTargetJack :public fxcc::Base
			{
				struct Desc
				{
					ImageMipmap::MipMapData m_MipmapData;

					int m_NumTextures{ 0 };

					fxcc::graph::common::AttachmentType m_AttachmentType = { fxcc::graph::common::AttachmentType::_Depth24_Stencil8_ };

					Desc() = default;

					Desc(int numTexture, const ImageMipmap::MipMapData& data)
						:m_NumTextures(numTexture), m_MipmapData(data)
					{

					};

					Desc(int numTexture, int w, int h, int nr, int hdr)
						:m_NumTextures(numTexture)
					{
						m_MipmapData.m_Width = w;
						m_MipmapData.m_Height = h;
						m_MipmapData.m_NrComponent = nr;
						m_MipmapData.m_HDR = hdr;

					}
				} m_Desc;

				RenderTargetJack(const fxcc::graph::common::RenderTargetJack::Desc& desc)
					:m_Desc(desc)
				{

				}

				virtual void Load() {}

				float Aspect() const
				{
					return m_Desc.m_MipmapData.Aspect();
				}

				virtual void Begin() const {
					assert(true);
				};

				virtual void End() const {
					assert(true);
				};

				virtual int GetPickupIndex(int attachment, glm::ivec2 pos) { 
					assert(true);
					return 0; };

				virtual int GetPickupIndexAxis(int attachment, glm::vec2 posAxis) {
					assert("get pickup index");
					return 0; };

				virtual void ClearColor(const glm::vec4& color)
				{
					assert("clear color");
				}
				virtual void ClearBuffer(int color, int depthStencil)
				{
					assert("clear buffer");
				}
			public:
				std::vector<std::shared_ptr<fxcc::graph::common::Texture2DJack>> m_Textures;

				std::shared_ptr<fxcc::graph::common::Texture2DJack > m_DepthStencilTexture;

				std::shared_ptr<fxcc::graph::common::Texture2DJack> GetTexture(const int index)
				{
					return m_Textures[index];
				};

				int GetNumTextures() const { return m_Textures.size(); };

				ImTextureID GetTexture(int index) const {
					if (index < m_Textures.size())
						return m_Textures[index]->GetTextureId(); 
				
					return 0;
				};
			};
		};
	};
}
;